package cn.biplam.common.client;

import java.rmi.RemoteException;

import cn.biplam.common.interfaces.OperatorExchangeServer;
import cn.biplam.common.tools.RMITOOLS;
import cn.biplam.common.wrapper.ErrorMessage;

/**
 * 数据操作交换类
 * @author WangSong 2009-9-22下午07:21:21
 * @version 1.0
 */
public abstract class OperatorExchange {
	
	
	/**
	 * 取执行sql结果
	 * @param opId  操作id
	 * @param userId 用户id
	 * @param filter 过滤条件
	 * @param dbResource 数据源
	 * @return 执行sql结果
	 * @throws RemoteException
	 * @throws ErrorMessage
	 */
	public static OperatorResult get(String opId, 
			  						 String userId, 
			  						 DataFilter filter,
			  						 DbResource dbResource) throws ErrorMessage{
		OperatorResult mOperatorResult = null;
		try {
			OperatorExchangeServer mOperatorExchangeServer = (OperatorExchangeServer)RMITOOLS.getInstance("OperatorExchangeServer");
			mOperatorResult = mOperatorExchangeServer.get(opId,userId,filter,dbResource);
		} catch (ErrorMessage e) {
			throw e;
		} catch (Exception e) {
			throw new ErrorMessage(e,"OperatorExchange.get failed("+opId+") ");
		}
		return mOperatorResult;
	}
}
